@file:JvmName("Descan")
package com.darkevil.descan

import com.darkevil.descan.util.DiskUtil
import java.io.File


/**
 * 扫描u盘，并删除u盘内所有文件
 * Created by darkevil on 17-7-20.
 */
fun main(args: Array<String>) {
    if(args.size>0){
        DiskUtil.IGNORE_TAG_FILENAME=args[0]    //忽略标记文件
    }

    while (true) {
        println("扫描开始")
        val drives = File.listRoots()
        for (drive in drives) {
//        println(DiskUtil.getDriveType(drive.path))
//        println(DiskUtil.isUPan(drive.path))
            if (DiskUtil.isUPan(drive.path) && !DiskUtil.isEmptyDrive(drive)) {
                println("发现u盘")
                if(DiskUtil.isIgnoreDrive(drive)){
                    println("忽略该u盘==>"+drive.path)
                }else{
                    DiskUtil.removeAllFile(drive.path)
                }
            }
        }
        println("扫描结束-睡一会")
        Thread.sleep(500)
    }


}
